/* BookAnalysis.vue 样式文件 */

.book-analysis-container {
  height: 100%;
  overflow: hidden;
}

/* 左侧导航栏样式 */
.record-nav {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0;
  box-sizing: border-box;
}

.nav-header {
  padding: 16px;
  border-bottom: 1px solid var(--n-border-color);
  flex-shrink: 0;
}

.record-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.loading-container,
.empty-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 16px;
}

.record-list :deep(.n-menu-item) {
  margin: 0;
  height: auto;
  padding: 0;
  position: relative;
  padding-right: 40px !important; /* 增加右侧内边距，为删除按钮留出空间 */
}

.record-list :deep(.n-menu-item::after) {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

/* 根据状态设置菜单项的底色 */
.record-list :deep(.n-menu-item[data-status="processing"]),
.record-list :deep(.record-status-processing) {
  background-color: rgba(24, 144, 255, 0.15) !important;
}

.record-list :deep(.n-menu-item[data-status="processing"])::after,
.record-list :deep(.record-status-processing)::after {
  background-color: #1890ff;
}

.record-list :deep(.n-menu-item[data-status="failed"]),
.record-list :deep(.record-status-failed) {
  background-color: rgba(255, 77, 79, 0.15) !important;
}

.record-list :deep(.n-menu-item[data-status="failed"])::after,
.record-list :deep(.record-status-failed)::after {
  background-color: #ff4d4f;
}

.record-list :deep(.n-menu-item[data-status="completed"]),
.record-list :deep(.record-status-completed) {
  background-color: rgba(82, 196, 26, 0.15) !important;
}

.record-list :deep(.n-menu-item[data-status="completed"])::after,
.record-list :deep(.record-status-completed)::after {
  background-color: #52c41a;
}

.record-list :deep(.n-menu-item[data-status="pending"]),
.record-list :deep(.record-status-pending) {
  background-color: rgba(240, 240, 240, 0.5) !important;
}

.record-list :deep(.n-menu-item[data-status="pending"])::after,
.record-list :deep(.record-status-pending)::after {
  background-color: #d9d9d9;
}

/* 确保菜单项选中状态下的背景色也能正确显示 */
.record-list :deep(.n-menu-item.n-menu-item--selected[data-status="processing"]) {
  background-color: rgba(24, 144, 255, 0.25) !important;
}

.record-list :deep(.n-menu-item.n-menu-item--selected[data-status="failed"]) {
  background-color: rgba(255, 77, 79, 0.25) !important;
}

.record-list :deep(.n-menu-item.n-menu-item--selected[data-status="completed"]) {
  background-color: rgba(82, 196, 26, 0.25) !important;
}

.record-list :deep(.n-menu-item.n-menu-item--selected[data-status="pending"]) {
  background-color: rgba(240, 240, 240, 0.7) !important;
}

.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  position: relative;
  width: 100%;
}

.menu-item-content {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  margin-right: 8px;
}

.menu-item-actions {
  opacity: 0.7;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

.menu-item:hover .menu-item-actions {
  opacity: 1;
}

.menu-item-actions .n-button {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
}

.menu-item-title {
  font-weight: 500;
  color: var(--n-text-color);
}

.menu-item-status {
  display: flex;
  align-items: center;
}

.status-tag {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.status-pending {
  background-color: #f0f0f0;
  color: #666;
}

.status-processing {
  background-color: #e6f7ff;
  color: #1890ff;
}

.status-completed {
  background-color: #f6ffed;
  color: #52c41a;
}

.status-failed {
  background-color: #fff2f0;
  color: #ff4d4f;
}

/* 底部设置区域 */
.nav-settings {
  padding: 16px;
  border-top: 1px solid var(--n-border-color);
  flex-shrink: 0;
}

.settings-section {
  margin-bottom: 16px;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-label {
  font-size: 12px;
  color: var(--n-text-color-3);
  margin-bottom: 8px;
}

/* 右侧内容区样式 */
.content-preview {
  height: 99%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.analyzing-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.analyzing-description {
  text-align: center;
  max-width: 400px;
}

.analyzing-description h3 {
  margin-bottom: 16px;
  color: var(--n-text-color);
}

.analyzing-description p {
  margin-bottom: 24px;
  color: var(--n-text-color-2);
}

.results-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 为n-tabs组件添加滚动条样式 */
.results-container :deep(.n-tabs-nav) {
  padding: 0 20px;
}

.results-container :deep(.n-tabs-content) {
  height: 100%;
  overflow: hidden;
}

.results-container :deep(.n-tab-pane) {
  height: 100%;
  overflow: hidden;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--n-border-color);
}

.results-header h3 {
  margin: 0;
  color: var(--n-text-color);
}

.results-actions {
  display: flex;
  gap: 8px;
}

.result-content {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
  max-height: calc(100vh - 200px);
  /* 自定义滚动条样式 - 使用Naive UI风格 */
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

/* Webkit浏览器滚动条样式 */
.result-content::-webkit-scrollbar {
  width: 6px;
}

.result-content::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 3px;
}

.result-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
  transition: background 0.2s;
}

.result-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Firefox滚动条样式 */
@supports (scrollbar-width: thin) {
  .result-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
  }
}

.result-item {
  margin-bottom: 24px;
  border: 1px solid var(--n-border-color);
  border-radius: 6px;
  overflow: hidden;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: var(--n-card-color);
  border-bottom: 1px solid var(--n-border-color);
}

.result-header h4 {
  margin: 0;
  color: var(--n-text-color);
}

.result-body {
  padding: 16px;
  background-color: var(--n-card-color);
  color: var(--n-text-color-2);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Markdown样式 */
.result-body h1 {
  font-size: 1.8em;
  font-weight: bold;
  margin: 0.8em 0 0.5em 0;
  color: var(--n-text-color);
}

.result-body h2 {
  font-size: 1.5em;
  font-weight: bold;
  margin: 0.7em 0 0.4em 0;
  color: var(--n-text-color);
}

.result-body h3 {
  font-size: 1.2em;
  font-weight: bold;
  margin: 0.6em 0 0.3em 0;
  color: var(--n-text-color);
}

.result-body p {
  margin: 0.8em 0;
  word-wrap: break-word;
}

.result-body ul {
  margin: 0.8em 0;
  padding-left: 2em;
}

.result-body li {
  margin: 0.3em 0;
}

.result-body code {
  background-color: rgba(0, 0, 0, 0.1);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.9em;
}

.result-body pre {
  background-color: rgba(0, 0, 0, 0.05);
  padding: 1em;
  border-radius: 5px;
  overflow-x: auto;
  margin: 0.8em 0;
}

.result-body pre code {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
}

.result-body a {
  color: #409eff;
  text-decoration: none;
}

.result-body a:hover {
  text-decoration: underline;
}

.no-results {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
}

.start-analysis-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 300px;
}

@media (max-width: 768px) {
  .results-container {
    padding: 12px;
  }
  
  .nav-header {
    padding: 12px;
  }
}

/* 状态显示样式 */
.status-processing,
.status-completed,
.status-failed,
.status-pending {
  font-size: 14px;
  font-weight: 500;
  margin-left: 8px;
}

.status-processing {
  color: #1890ff;
}

.status-completed {
  color: #52c41a;
}

.status-failed {
  color: #ff4d4f;
}

.status-pending {
  color: #8c8c8c;
}